//
//  PingAssistor.h
//  iOSLaboratory
//
//  Created by yangshansi on 2017/4/19.
//  Copyright © 2017年 WiLL. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "PingTaskResult.h"




typedef enum PingMethod {
    PingMethodICMP = 0,
    PingMethodHTTP
} PingMethod;





@interface PingTask : NSObject

@property (nonatomic, readonly, copy  ) NSString   *hostName;
@property (nonatomic, readonly, assign) NSInteger  retryCount;
@property (nonatomic, readonly, assign) NSInteger  timeout;
@property (nonatomic, readonly, strong) NSData     *data;
@property (nonatomic, readonly, assign) PingMethod pingMethod;

@property (nonatomic, readonly, strong) NSMutableArray *pingList;

@property (nonatomic, readonly, strong) PingTaskResult *result;


/******************************************************************************/
/**** Static Method                                                        ****/
/******************************************************************************/
#pragma mark - Static Method

+ (instancetype)pingTaskWithHost:(NSString *)hostName
                      retryCount:(NSInteger)retryCount
                         timeout:(NSInteger)timeout
                            data:(NSData *)data
                      pingMethod:(PingMethod)pingMethod;

+ (instancetype)pingTaskWithHost:(NSString *)hostName
                      retryCount:(NSInteger)retryCount
                            data:(NSData *)data
                      pingMethod:(PingMethod)pingMethod;

+ (instancetype)pingTaskWithHost:(NSString *)hostName
                            data:(NSData *)data
                      pingMethod:(PingMethod)pingMethod;




/******************************************************************************/
/**** Lifecycle Method                                                     ****/
/******************************************************************************/
#pragma mark - Lifecycle Method

- (instancetype)init NS_UNAVAILABLE;

- (instancetype)initWithHost:(NSString *)hostName
                  retryCount:(NSInteger)retryCount
                     timeout:(NSInteger)timeout
                        data:(NSData *)data
                  pingMethod:(PingMethod)pingMethod;



/******************************************************************************/
/**** Customized Method                                                    ****/
/******************************************************************************/
#pragma mark - Customized Method

- (PingTaskResult *)doTask;

@end
